(a) (b)
Next step of using the K-means for the toy data set. (a) The two centres have
ed. (b) New membership functions assigned to data points.
these new updates, two cluster centres stopped change. A
process was thus terminated.
The membership function values in two steps of using the K-means algorithm
et of seven data points and two clusters shown in Figure 2.22.
Step 1
Step 2
x
݂ሺۯሻ
݂ሺ۰ሻ
x
݂ሺۯሻ
݂ሺ۰ሻ
1
1
0
1
1
0
2
1
0
2
1
0
3
0
1
3
1
0
4
0
1
4
0
1
5
0
1
5
0
1
6
0
1
6
0
1
7
0
1
7
0
1
R function for the K-means algorithm is kmeans and its syntax is
elow, where x is a matrix and centers is the parameter for
g the number of clusters,
kmeans(x,centers,···)
e 2.24 shows the application of a data set of two clusters. A K-
odel was constructed on this data set and it indeed revealed this
ructure. Suppose the data set was saved in a variable named by x.
below was used to apply the kmeans function to the data set,
model=kmeans(x,centers=2)